package com.aptech.domain.JPA;

import java.sql.Timestamp;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * Topic entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "TOPIC", schema = "dbo", catalog = "Blue_Pumpkin")
public class Topic implements java.io.Serializable {

	// Fields

	private Integer topicId;
	private Account account;
	private String topicTitle;
	private Timestamp topicTime;
	private Integer referenceId;
	private String referenceTypeCode;
	private Timestamp createdDate;
	private Integer categoryId;
	private Set<Post> posts = new HashSet<Post>(0);

	// Constructors

	/** default constructor */
	public Topic() {
	}

	/** minimal constructor */
	public Topic(Integer topicId, Account account) {
		this.topicId = topicId;
		this.account = account;
	}

	/** full constructor */
	public Topic(Integer topicId, Account account, String topicTitle,
			Timestamp topicTime, Integer referenceId, String referenceTypeCode,
			Timestamp createdDate, Integer categoryId, Set<Post> posts) {
		this.topicId = topicId;
		this.account = account;
		this.topicTitle = topicTitle;
		this.topicTime = topicTime;
		this.referenceId = referenceId;
		this.referenceTypeCode = referenceTypeCode;
		this.createdDate = createdDate;
		this.categoryId = categoryId;
		this.posts = posts;
	}

	// Property accessors
	@Id
	@Column(name = "TOPIC_ID", unique = true, nullable = false)
        @GeneratedValue(strategy=GenerationType.IDENTITY)
	public Integer getTopicId() {
		return this.topicId;
	}

	public void setTopicId(Integer topicId) {
		this.topicId = topicId;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "ACCOUNT_ID", nullable = false)
	public Account getAccount() {
		return this.account;
	}

	public void setAccount(Account account) {
		this.account = account;
	}

	@Column(name = "TOPIC_TITLE", length = 250)
	public String getTopicTitle() {
		return this.topicTitle;
	}

	public void setTopicTitle(String topicTitle) {
		this.topicTitle = topicTitle;
	}

	@Column(name = "TOPIC_TIME", length = 23)
	public Timestamp getTopicTime() {
		return this.topicTime;
	}

	public void setTopicTime(Timestamp topicTime) {
		this.topicTime = topicTime;
	}

	@Column(name = "REFERENCE_ID")
	public Integer getReferenceId() {
		return this.referenceId;
	}

	public void setReferenceId(Integer referenceId) {
		this.referenceId = referenceId;
	}

	@Column(name = "REFERENCE_TYPE_CODE", length = 50)
	public String getReferenceTypeCode() {
		return this.referenceTypeCode;
	}

	public void setReferenceTypeCode(String referenceTypeCode) {
		this.referenceTypeCode = referenceTypeCode;
	}

	@Column(name = "CREATED_DATE", length = 23)
	public Timestamp getCreatedDate() {
		return this.createdDate;
	}

	public void setCreatedDate(Timestamp createdDate) {
		this.createdDate = createdDate;
	}

	@Column(name = "CATEGORY_ID")
	public Integer getCategoryId() {
		return this.categoryId;
	}

	public void setCategoryId(Integer categoryId) {
		this.categoryId = categoryId;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "topic")
	public Set<Post> getPosts() {
		return this.posts;
	}

	public void setPosts(Set<Post> posts) {
		this.posts = posts;
	}

}